import store from '@/store'

let haslog = false
// 用于根据资源权限隐藏按钮
export function permissionFn (el: HTMLElement, binding: any) {
  const value = binding.value
  const resourceList = store.state.resourceList as Array<{
      id: number
      description: string
    }>

  if (!haslog) {
    resourceList.forEach(item => {
      console.log(item.description, item.id)
    })
    haslog = true
  }
  const find = resourceList.find(item => item.id === value)
  if (!find) {
    el.style.display = 'none'
  }
}
